package xyz.ddlnt.servicegeneralclient.client.fallback;

import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.web.multipart.MultipartFile;
import xyz.ddlnt.commonutil.enumeration.ResultCode;
import xyz.ddlnt.commonutil.exception.GlobalException;
import xyz.ddlnt.commonutil.result.Result;
import xyz.ddlnt.model.vo.FileUploadVO;
import xyz.ddlnt.servicegeneralclient.client.MinioFeignClient;


@Slf4j
public class MinioFallbackFactory implements FallbackFactory<MinioFeignClient> {

    @Override
    public MinioFeignClient create(Throwable cause) {
        return new MinioFeignClient(){

            @Override
            public Result<FileUploadVO> upload(MultipartFile file) {
                throw new GlobalException(ResultCode.THE_REMOTE_PROCEDURE_CALL_FAILED);
            }
        };
    }
}